#include <iostream>
#include <string>
#include <stack>

int main() {
    std::string s;
    std::getline(std::cin, s);
    std::stack<char> s1;
    for (char c : s) {
        if (c == '(' || c == '{' || c == '[') {
            s1.push(c);
        }
        if (c == ')') {
            if (!s1.empty() && s1.top() == '(') {
                s1.pop();
            } else {
                std::cout << "False" << std::endl;
                return 0;
            }
        }
        if (c == '}') {
            if (!s1.empty() && s1.top() == '{') {
                s1.pop();
            } else {
                std::cout << "False" << std::endl;
                return 0;
            }
        }
        if (c == ']') {
            if (!s1.empty() && s1.top() == '[') {
                s1.pop();
            } else {
                std::cout << "False" << std::endl;
                return 0;
            }
        }
    }
    if (s1.empty()) {
        std::cout << "True" << std::endl;
    } else {
        std::cout << "False" << std::endl;
    }
    return 0;
}
